package com.bupt.order.client;


import com.bupt.config.FeignClientsConfigurationCustom;
import com.bupt.config.FeignErrorDecoder;
import com.bupt.order.dto.OrderDto;
import com.bupt.order.entity.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@FeignClient(value = "order-service", configuration = {FeignErrorDecoder.class, FeignClientsConfigurationCustom.class})
public interface OrderClient {

    @RequestMapping("/order/getAllOrders")
    List<Order> getAllOrders();

    @RequestMapping("/order/getOrdersByUserId")
    List<Order> getOrdersByUserId(@RequestParam String userId);

    @RequestMapping("/order/getOrdersByModel")
    List<Order> getOrdersByModel(@RequestBody Order order);

    @RequestMapping("/order/getOrdersCountByModel")
    Map<String, Object> getOrdersCountByModel(@RequestBody Order order);

    @RequestMapping("/order/getTicketsSoldNumByModel")
    Map<String, Object> getTicketsSoldNumByModel(@RequestBody Order order);

    //    @PostMapping("/order/createOrder")
//    void createOrder(@RequestBody Order order);
    @PostMapping("/order/createOrder")
    void createOrder(@RequestBody OrderDto orderDto);

    @PostMapping("/order/getUserSessionTest")
    String getUserSessionTest();
}
